package com.ptswitch.material.pages.contract;

import java.util.ArrayList;
import java.util.List;

import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.ptswitch.material.model.contract.ContractItem;
import com.ptswitch.material.pages.base.MaterialBasePage;
import com.ptswitch.material.service.ContractItemService;

public class EditItems extends MaterialBasePage {
    @Inject
    private ContractItemService contractItemSer;
    @Property
    private String id;
    @Property
    private List<ContractItem> items;
    @Property
    private List<ContractItem> selectItems;

    @OnEvent(value = EventConstants.ACTIVATE)
    Object init(String id) {
        this.id = id;
        items = contractItemSer.findByContract(id);
        selectItems = new ArrayList<ContractItem>();
        return null;
    }

    @OnEvent(value = EventConstants.SUCCESS, component = "update")
    Object update() {
        for (ContractItem item : selectItems) {
        }
        return null;
    }

}
